
package com.ubox.mqtt_upush;

import java.util.Date;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.ubox.mqtt_upush.dao.ClientOfPhoneRepository;
import com.ubox.mqtt_upush.dao.ClientRepository;
import com.ubox.mqtt_upush.dao.PhoneRepository;
import com.ubox.mqtt_upush.domain.Client;
import com.ubox.mqtt_upush.domain.ClientOfPhone;
import com.ubox.mqtt_upush.domain.Phone;
import com.ubox.mqtt_upush.utils.JsonUtil;

/**
 * Integration tests for {@link LogRepository}.
 *
 * @author Oliver Gierke
 */

public class ClientOfPhoneDaoTests2 extends BaseTest {

	@Autowired
	ClientOfPhoneRepository c;

	@Test
	public void ClientOfPhonetTest() {
		try {

			ClientOfPhone d = new ClientOfPhone();
			d.setCentral("mingbaotest");
			d.setUser(1232323423423423l);
			d.setCreateTime(new Date());
			d.setUpdateTime(new Date());
			ClientOfPhone t = c.findByUser(d.getUser()).get(0);
			if (t != null) {
				c.delete(t.getId());
			}
			c.save(d);

			List<ClientOfPhone> list = c.findAll();

			System.out.println(JsonUtil.toString(list));

		} catch (Exception e) {
			e.printStackTrace();
			throw e;
		}
	}
}
